def find_answer(question):
    with open('reply.txt','r',encoding='utf-8') as file:
        while True:
            line=file.readline()
            if not line:#if line==''到文件末尾退出
                break
            #字符串的分割
            keyword=line.split('|')[0]
            reply=line.split('|')[1]
            if keyword in question:
                return reply
    return False
if __name__ == '__main__':
    question=input('hi 您好，小蜜等您很久了，有什么需要帮助的')
    while True:
    #开始在文件中查护找
        if question=='bye':
            break
        reply=find_answer(question)
        if not reply: #False
            question=input('你说啥，问别的（退出输入bye）')
        else:
            print(reply)
            question=input('还问吗退出按bye')
print('再见')